<!-- 卡片列表组件 -->
<template>
  <view class="card-box" @click="toDetail">
    <!-- 图片区域 -->
    <view class="left">
      <van-image
        radius="8"
        height="160rpx"
        width="260rpx"
        :src="item.courseLogo"
      />
    </view>
    <!-- 文字区域 -->
    <view class="right">
      <view class="right-title">{{ item.courseName }}</view>
      <!-- <view class="right-desc">{{ item.introduce }}</view> -->
      <view class="right-bottom">
        <view></view>
        <view v-if="!!item.collect"
          ><van-rate v-model="item.collect" :count="1"></van-rate>已收藏</view
        >
      </view>
    </view>
  </view>
</template>

<script>
export default {
  name: "Card",
  props: {
    item: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {};
  },
  methods: {
    toDetail() {
      uni.setStorageSync("courseId", this.item.id);
      uni.navigateTo({
        url: `/pages/courseDetail/index`,
      });
    },
  },
};
</script>

<style scoped>
.card-box {
  padding: 0 20rpx;
  height: 220rpx;
  border-bottom: 2rpx solid #e8e8e8;
  display: flex;
}
.left {
  padding-top: 30rpx;
}
.right {
  position: relative;
  padding-top: 30rpx;
  margin-left: 20rpx;
  flex: 1;
}
.right-title {
  font-size: 32rpx;
  color: #333;
  font-weight: 600;
}
.right-desc {
  margin-top: 10rpx;
  font-size: 24rpx;
  color: #999;
}
.right-bottom {
  position: absolute;
  bottom: 30rpx;
  font-size: 24rpx;
  display: flex;
  justify-content: space-between;
  align-content: center;
  color: #c0c0c0;
  width: 100%;
}
</style>